﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:localControls="clr-namespace:CollectionViewSourceSpikes.Controls"
    xmlns:local="clr-namespace:CollectionViewSourceSpikes"
    xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" x:Class="CollectionViewSourceSpikes.MainPage"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400"
    >
    <Grid x:Name="LayoutRoot" Background="White">

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <StackPanel Orientation="Horizontal" Grid.ColumnSpan="2">
            

            <Button Content="大きい順番でソート" Click="Button_Click" />
            <Button Content="小さい順番でソート" Click="Button_Click_1" />
            <Button Content="ソートを解除" Click="Button_Click_2" />
            <Button Content="カテゴリでグルーピング" Click="Button_Click_3" />
            <Button Content="カテゴリと日付でグルーピング" Click="Button_Click_3_1" />
            <Button Content="グルーピングを解除" Click="Button_Click_4" />
            <Button Content="カテゴリDを追加" Click="Button_Click_5" />
            <Button Content="カテゴリDを複数追加" Click="Button_Click_6" />
            <Button Content="SelectedItemを変更" Click="Button_Click_7" />
        </StackPanel>
        <Grid Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <TextBox x:Name="ItemsTextBox" AcceptsReturn="True" />
            <ListBox x:Name="SampleListBox" Grid.Row="1" Style="{StaticResource ListBoxStyle1}"  ItemContainerStyle="{StaticResource ListBoxItemStyle1}" />
        	<sdk:TreeView x:Name="SampleTreeView" Grid.Row="2" d:LayoutOverrides="Height"  />
           
           </Grid>
        
        <localControls:GroupingView x:Name="groupingView" Grid.Row="1" Grid.Column="1">
            <localControls:GroupingView.Resources>
                <DataTemplate DataType="{localControls:Type Target=System.DateTime}" x:Key="DateTimeTypeDataTemplate">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding StringFormat=yyyy/MM/dd}" />
                        <TextBlock Text="GroupingView-DateTime" />
                    </StackPanel>
                </DataTemplate>
                <DataTemplate DataType="{localControls:Type Target=sys:String}" x:Key="StringTypeDataTemplate">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding ''}" />
                        <TextBlock Text="GroupingView-String" />
                    </StackPanel>
                </DataTemplate>
            </localControls:GroupingView.Resources>
            <localControls:GroupingView.GroupStyle>
                <Style TargetType="localControls:GroupingViewGroup">
                    <Setter Property="FontWeight" Value="Bold" />
                </Style>
            </localControls:GroupingView.GroupStyle>
            <!--<localControls:GroupingView.GroupTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding }" />
                </DataTemplate>
            </localControls:GroupingView.GroupTemplate>-->
            <localControls:GroupingView.ItemStyle>
                <Style TargetType="localControls:GroupingViewItem">
                    <Setter Property="FontWeight" Value="Normal" />
                </Style>
            </localControls:GroupingView.ItemStyle>
            <localControls:GroupingView.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Day}" />
                        <TextBlock Text="に登録された" />
                        <TextBlock Text="{Binding Category}" />
                    </StackPanel>
                </DataTemplate>
            </localControls:GroupingView.ItemTemplate>
        </localControls:GroupingView>
    </Grid>
</UserControl>
